package com.ljt.kotlinandmvvm.main.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.ljt.kotlinandmvvm.R
import com.ljt.kotlinandmvvm.main.viewholder.RecommendToYouViewHolder

/**
 * @auther :lujiantao
 * @date :2024/5/4 12:54 PM
 * @desc :为您推荐adapter
 */
class RecommendToYouAdapter(private val list:ArrayList<String>): RecyclerView.Adapter<RecommendToYouViewHolder>(){
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecommendToYouViewHolder {
        val itemViewHolder = LayoutInflater.from(parent.context).inflate(R.layout.item_recommend_to_you,parent,false)
        return RecommendToYouViewHolder(itemViewHolder)
    }

    override fun onBindViewHolder(holder: RecommendToYouViewHolder, position: Int) {
        var str :String = list[position]
        with(holder){
            tvModuleCommandityName.text = str
        }
    }

    override fun getItemCount(): Int {
        return list.size
    }
}